********************************************************************************* 
******************************* Replication File ********************************
*********** Zorzeta Bakaki & Marius Mehrl, International Interactions ***********
** "Examining conflict management technique sequences in international claims" **
*********************************************************************************
*********************************************************************************

* Analysis run in Stata 14

* relevant non-standard packages
* collin (net install collin.pkg)
* btscs (https://www.prio.org/Data/Stata-Tools/)
* gologit2 (net install st0097_2.pkg)


* Load Data (Change directory according to file location)
use "C:\~\Replication Data.dta", replace

* Italy is considered as a country with a number of claims before 1861, polity2 values only available from 1861 onwards.
* We have taken the values of all recorded parts of italy (e.g. sardinia, tuscany, sicily) and use their yearly average for Italy pre-1861
* replace tgt_polity2= -10 if tgt==325 & year<1848
* replace tgt_polity2= -9 if tgt==325 & year>=1848 & year<1861
* replace chal_polity2= -10 if chal==325 & year<1848
* replace chal_polity2= -9 if chal==325 & year>=1848 & year<1861

keep claimdy settnump nonbind3 binding3 settnump effect4 year chal_cinc tgt_cinc chal tgt ///
icowsal chal_polity2 tgt_polity2 claim_duration issue claim ratfail agree comply2 clmendall ///
extentsa3 actor1 actor2 actor3 actor4 actor5 actor6 io recmidwt riveriss mariss dyadnum

********************
* Data Preparation *
********************

* Construct Main Independent Variable: CMT Sequence
set sortseed 123
xtset  claimdy settnump

gen nonbind3_carryover = nonbind3 
replace nonbind3_carryover=nonbind3_carryover[_n-1] if nonbind3_carryover==0 & l.nonbind3_carryover!=.
gen binding3_carryover = binding3
replace binding3_carryover=binding3_carryover[_n-1] if binding3_carryover==0 & l.binding3_carryover!=.

gen cmt_sequenc_ag=.
replace cmt_sequenc_ag=0 if nonbind3_carryover==0 & binding3_carryover==0
replace cmt_sequenc_ag=1 if nonbind3_carryover==1 & binding3_carryover==0
replace cmt_sequenc_ag=1 if nonbind3_carryover==0 & binding3_carryover==1
replace cmt_sequenc_ag=2 if l.nonbind3_carryover==1 & l.binding3_carryover==0 & nonbind3_carryover==1 & binding3_carryover==1
replace cmt_sequenc_ag=2 if l.nonbind3_carryover==0 & l.binding3_carryover==1 & nonbind3_carryover==1 & binding3_carryover==1
replace cmt_sequenc_ag=cmt_sequenc_ag[_n-1] if cmt_sequenc_ag==. & l.cmt_sequenc_ag!=. & l.cmt_sequenc_ag==2
replace cmt_sequenc_ag=. if settnump<2
replace cmt_sequenc_ag=. if cmt_sequenc_ag==0
replace cmt_sequenc_ag= cmt_sequenc_ag-1
tab cmt_sequenc_ag

* Construct Depnedent Variable: Conflict management effectiveness
gen effect4_w0=effect4
replace effect4_w0=0 if agree==0

* Construct Selection Variable for two-stage ordered probit models, 
* also compute the length of non-eventful spells
gen cm_select=.
replace cm_select=0 if cmt_sequenc_ag==.
replace cm_select=1 if cmt_sequenc_ag!=.
btscs  cm_select year claimdy, g(cm_selectyears)

* Generate other variables for analysis
gen ratio_cinc=chal_cinc/tgt_cinc
gen logratio_cinc=ln(ratio_cinc)
gen prev_attempts=.
replace prev_attempts=0 if settnump==1
replace prev_attempts=1 if settnump>1 & settnump!=.

label define outcome 0 "No Agreement" 1 "Agreement" 2 "Ratification" 3 "Compliance" 4 "Claim Ends"
label values effect4_ outcome


*****************
* Main Analysis *
*****************

* Figure 1: Distribution of conflict management effectiveness
hist effect4_w0 if cmt_sequenc_ag!=., discrete frequency addlabels scheme(plotplain) title (Conflict management effectiveness) xtitle(" ") xlabel(-1 " " 0  "No agreement" 1 "Agreement" 2 "Ratification" 3 "Compliance" 4 "Claim ends", angle(45)) 

* Table 2: Relationship between CMT sequence and conflict management effectiveness
tab effect4_w0 cmt_sequenc_ag

* Table 3: Descriptive statistics (first row produces columns 1-6; second row column 7 )
sum cmt_sequenc_ag ratio_cinc icowsal chal_polity2 tgt_polity2 settnump claim_duration i.issue
collin cmt_sequenc_ag ratio_cinc icowsal chal_polity2 tgt_polity2 settnump claim_duration riveriss mariss

* Table 4: The impact of CMT sequences on conflict management effectiveness
oprobit effect4_   i.cmt_sequenc_ag, cluster(claim)
oprobit effect4_   i.cmt_sequenc_ag ratio_cinc icowsal chal_polity2 tgt_polity2 settnump claim_duration i.issue, cluster(claim)
heckoprobit effect4_ i.cmt_sequenc_ag ratio_cinc icowsal chal_polity2 tgt_polity2 settnump claim_duration i.issue, select(cm_select = ratio_cinc icowsal chal_polity2 tgt_polity2 claim_duration i.issue c.cm_selectyears##c.cm_selectyears##c.cm_selectyears) cluster(claim)
heckoprobit effect4_ i.cmt_sequenc_ag binding3 ratio_cinc icowsal chal_polity2 tgt_polity2 settnump claim_duration i.issue, select(cm_select = ratio_cinc icowsal chal_polity2 tgt_polity2 claim_duration i.issue c.cm_selectyears##c.cm_selectyears##c.cm_selectyears) cluster(claim)

* Table 5: The substantive effect of CMT sequences – expected outcome categories
quietly oprobit effect4_   i.cmt_sequenc_ag, cluster(claim)
margins, expression(predict(outcome(0))*0+1*predict(outcome(1))+2*predict(outcome(2))+3*predict(outcome(3))+4*predict(outcome(4))) at(cmt_sequenc_ag=(0(1)1)) level(90)
quietly oprobit effect4_   i.cmt_sequenc_ag ratio_cinc icowsal chal_polity2 tgt_polity2 settnump claim_duration i.issue, cluster(claim)
margins, expression(predict(outcome(0))*0+1*predict(outcome(1))+2*predict(outcome(2))+3*predict(outcome(3))+4*predict(outcome(4))) at(cmt_sequenc_ag=(0(1)1)) level(90)
quietly heckoprobit effect4_ i.cmt_sequenc_ag ratio_cinc icowsal chal_polity2 tgt_polity2 settnump claim_duration i.issue, select(cm_select = ratio_cinc icowsal chal_polity2 tgt_polity2 claim_duration i.issue c.cm_selectyears##c.cm_selectyears##c.cm_selectyears) cluster(claim)
margins, expression(predict(outcome(0))*0+1*predict(outcome(1))+2*predict(outcome(2))+3*predict(outcome(3))+4*predict(outcome(4))) at(cmt_sequenc_ag=(0(1)1)) level(90)
quietly heckoprobit effect4_ i.cmt_sequenc_ag binding3 ratio_cinc icowsal chal_polity2 tgt_polity2 settnump claim_duration i.issue, select(cm_select = ratio_cinc icowsal chal_polity2 tgt_polity2 claim_duration i.issue c.cm_selectyears##c.cm_selectyears##c.cm_selectyears) cluster(claim)
margins, expression(predict(outcome(0))*0+1*predict(outcome(1))+2*predict(outcome(2))+3*predict(outcome(3))+4*predict(outcome(4))) at(cmt_sequenc_ag=(0(1)1)) level(90)

* Figure 2: The substantive effect of CMT sequences – First difference estimates
heckoprobit effect4_ i.cmt_sequenc_ag ratio_cinc icowsal chal_polity2 tgt_polity2 settnump claim_duration i.issue, select(cm_select = ratio_cinc icowsal chal_polity2 tgt_polity2 claim_duration i.issue c.cm_selectyears##c.cm_selectyears##c.cm_selectyears) cluster(claim)
margins, dydx(cmt_sequenc_ag) level(95) post
estimates store one
heckoprobit effect4_ i.cmt_sequenc_ag binding3 ratio_cinc icowsal chal_polity2 tgt_polity2 settnump claim_duration i.issue, select(cm_select = ratio_cinc icowsal chal_polity2 tgt_polity2 claim_duration i.issue c.cm_selectyears##c.cm_selectyears##c.cm_selectyears) cluster(claim)
margins, dydx(cmt_sequenc_ag) level(95) post
estimates store two

coefplot (one, label(Model Three)) (two, label(Model Four)) , xline(0) scheme(plotplain) xtitle("Change in Probability") level(95) ///
aspectratio(1) ylabel(1 "No Agreement" 2 "Agreement" 3 "Ratification" 4 "Compliance" 5 "Claim Ends") xlabel(-.4(.1).2)
 
* Tests for Footnote 10
spearman  settnump cmt_sequenc_ag
kwallis settnump, by(cmt_sequenc_ag)

* Tests for Footnote 11
heckoprobit effect4_ i.cmt_sequenc_ag binding3 ratio_cinc icowsal chal_polity2 tgt_polity2 settnump claim_duration i.issue, select(cm_select = ratio_cinc icowsal chal_polity2 tgt_polity2 claim_duration i.issue c.cm_selectyears##c.cm_selectyears##c.cm_selectyears) cluster(claim)
margins, dydx(binding3) level(95)

 
*********************
* Appendix Analysis *
*********************

* Table A1: Generalized ordered probit
tab cmt_sequenc_ag, gen(cmtseqdum)
tab issue, gen(issdum)

gologit2 effect4_   cmtseqdum2 binding3 ratio_cinc icowsal chal_polity2 tgt_polity2 settnump claim_duration riveriss mariss, cluster(claim) ///
link(p) npl(cmtseqdum2)

* Table A2: Agreement and Ratification as dependent variables
gen ratification=.
replace ratification=0 if ratfail==1
replace ratification=1 if ratfail==0

heckprobit agree i.cmt_sequenc_ag binding3 ratio_cinc icowsal chal_polity2 tgt_polity2 settnump claim_duration i.issue, select(cm_select = ratio_cinc icowsal chal_polity2 tgt_polity2 claim_duration i.issue c.cm_selectyears##c.cm_selectyears##c.cm_selectyears) cluster(claim)
heckprobit ratification i.cmt_sequenc_ag binding3 ratio_cinc icowsal chal_polity2 tgt_polity2 settnump claim_duration i.issue, select(cm_select = ratio_cinc icowsal chal_polity2 tgt_polity2 claim_duration i.issue c.cm_selectyears##c.cm_selectyears##c.cm_selectyears) cluster(claim)

* Table A3: Compliance and Claim ends as dependent variables
heckprobit comply2 i.cmt_sequenc_ag binding3 ratio_cinc icowsal chal_polity2 tgt_polity2 settnump claim_duration i.issue, select(cm_select = ratio_cinc icowsal chal_polity2 tgt_polity2 claim_duration i.issue c.cm_selectyears##c.cm_selectyears##c.cm_selectyears) cluster(claim)
heckprobit clmendall i.cmt_sequenc_ag binding3 ratio_cinc icowsal chal_polity2 tgt_polity2 settnump claim_duration i.issue, select(cm_select = ratio_cinc icowsal chal_polity2 tgt_polity2 claim_duration i.issue c.cm_selectyears##c.cm_selectyears##c.cm_selectyears) cluster(claim)

* Table A4: Accounting for substantive attempts
set sortseed 123
gen effect4subsatt=effect4_
replace effect4subsatt=. if extentsa3!=2
gen cm_selectsubsatt=cm_select
replace cm_selectsubsatt=0 if effect4subsatt==. & cm_select!=.
replace cm_selectsubsatt=. if cm_select==1 & extentsa3!=2
btscs cm_selectsubsatt  year claimdy, g(selectssyears) 

heckoprobit effect4_ i.cmt_sequenc_ag binding3 ratio_cinc icowsal chal_polity2 tgt_polity2 settnump claim_duration i.issue i.extentsa3, select(cm_select = ratio_cinc icowsal chal_polity2 tgt_polity2 claim_duration i.issue c.cm_selectyears##c.cm_selectyears##c.cm_selectyears) cluster(claim)
heckoprobit effect4subsatt i.cmt_sequenc_ag i.binding3 ratio_cinc icowsal chal_polity2 tgt_polity2 settnump claim_duration i.issue, select(cm_selectsubsatt = ratio_cinc icowsal chal_polity2 tgt_polity2 claim_duration i.issue c.selectssyears##c.selectssyears##c.selectssyears) cluster(claim)

* Table A5: Agreement and Ratification as dependent variables - Substantive attempts only
gen agreesubsatt=agree
replace agreesubsatt=. if extentsa3!=2
gen ratificationsubsatt=ratification
replace ratificationsubsatt=. if extentsa3!=2

heckprobit agreesubsatt i.cmt_sequenc_ag i.binding3 ratio_cinc icowsal chal_polity2 tgt_polity2 settnump claim_duration i.issue, select(cm_selectsubsatt = ratio_cinc icowsal chal_polity2 tgt_polity2 claim_duration i.issue c.selectssyears##c.selectssyears##c.selectssyears) cluster(claim)
heckprobit ratificationsubsatt i.cmt_sequenc_ag i.binding3 ratio_cinc icowsal chal_polity2 tgt_polity2 settnump claim_duration i.issue, select(cm_selectsubsatt = ratio_cinc icowsal chal_polity2 tgt_polity2 claim_duration i.issue c.selectssyears##c.selectssyears##c.selectssyears) cluster(claim)

* Table A6: Compliance and Claim ends as dependent variables - Substantive attempts only
gen comply2subsatt=comply2
replace comply2subsatt=. if extentsa3!=2
gen clmendallsubsatt=clmendall
replace clmendallsubsatt=. if extentsa3!=2

heckprobit comply2subsatt i.cmt_sequenc_ag i.binding3 ratio_cinc icowsal chal_polity2 tgt_polity2 settnump claim_duration i.issue, select(cm_selectsubsatt = ratio_cinc icowsal chal_polity2 tgt_polity2 claim_duration i.issue c.selectssyears##c.selectssyears##c.selectssyears) cluster(claim)
heckprobit clmendallsubsatt i.cmt_sequenc_ag i.binding3 ratio_cinc icowsal chal_polity2 tgt_polity2 settnump claim_duration i.issue, select(cm_selectsubsatt = ratio_cinc icowsal chal_polity2 tgt_polity2 claim_duration i.issue c.selectssyears##c.selectssyears##c.selectssyears) cluster(claim)

* Table A7: Disaggregating CMT sequences with changes
* Construct Variable distinguishing between single and multiple CMT changes
set sortseed 123
xtset  claimdy settnump

gen cmt_sequenc3=.
replace cmt_sequenc3=0 if nonbind3_carryover==0 & binding3_carryover==0
replace cmt_sequenc3=1 if nonbind3_carryover==1 & binding3_carryover==0
replace cmt_sequenc3=1 if nonbind3_carryover==0 & binding3_carryover==1
gen switchers=0
replace switchers=1 if nonbind3_carryover==1 & binding3_carryover==1
replace cmt_sequenc3=2 if switchers==1 & l.switchers==0
replace cmt_sequenc3=3 if cmt_sequenc3==. & switchers==1 & l.switchers==1 & nonbind3!=l.nonbind3 
replace cmt_sequenc3=3 if cmt_sequenc3==. & switchers==1 & l.switchers==1 & binding3!=l.binding3
replace cmt_sequenc3=2 if cmt_sequenc3==3 & switchers==1 & l.switchers==1 & binding3==0 & nonbind3==0
replace cmt_sequenc3=3 if cmt_sequenc3==2 & l.cmt_sequenc3==3
replace cmt_sequenc3=3 if cmt_sequenc3==. & l.cmt_sequenc3==3
replace cmt_sequenc3=2 if cmt_sequenc3==. & switchers==1
replace cmt_sequenc3=3 if claimdy==16401 & settnump==21
replace cmt_sequenc3=3 if claimdy==235201 & settnump==10
replace cmt_sequenc3=3 if claimdy==235201 & settnump==11
replace cmt_sequenc3=. if settnump<2
replace cmt_sequenc3=. if cmt_sequenc3==0
replace cmt_sequenc3=cmt_sequenc3-1
tab cmt_sequenc3

* Construct Variable distinguishing between change directions
gen cmt_sequencz=.
replace cmt_sequencz=0 if nonbind3_carryover==0 & binding3_carryover==0
replace cmt_sequencz=1 if nonbind3_carryover==1 & binding3_carryover==0
replace cmt_sequencz=1 if nonbind3_carryover==0 & binding3_carryover==1
tab claimdy if cmt_sequencz==. & nonbind3_carryover!=.
replace cmt_sequencz=2 if l.nonbind3_carryover==1 & l.binding3_carryover==0 & nonbind3_carryover==1 & binding3_carryover==1
replace cmt_sequencz=3 if l.nonbind3_carryover==0 & l.binding3_carryover==1 & nonbind3_carryover==1 & binding3_carryover==1
replace cmt_sequencz=cmt_sequencz[_n-1] if cmt_sequencz==. & l.cmt_sequencz!=. & l.cmt_sequencz>1
replace cmt_sequencz=. if settnump<2
replace cmt_sequencz=. if cmt_sequencz==0
replace cmt_sequencz=cmt_sequencz-1
tab cmt_sequencz

heckoprobit effect4_ i.cmt_sequenc3 binding3 ratio_cinc icowsal chal_polity2 tgt_polity2 settnump claim_duration i.issue, select(cm_select = ratio_cinc icowsal chal_polity2 tgt_polity2 claim_duration i.issue c.cm_selectyears##c.cm_selectyears##c.cm_selectyears) cluster(claim)
heckoprobit effect4_ i.cmt_sequencz binding3 ratio_cinc icowsal chal_polity2 tgt_polity2 settnump claim_duration i.issue, select(cm_select = ratio_cinc icowsal chal_polity2 tgt_polity2 claim_duration i.issue c.cm_selectyears##c.cm_selectyears##c.cm_selectyears) cluster(claim)

* Table A8: Additional Controls – Intervener Attributes
gen cmt_actornumber=0
replace cmt_actornumber=1 if actor1!=. & actor2==.
replace cmt_actornumber=2 if actor2!=. & actor3==.
replace cmt_actornumber=3 if actor3!=. & actor4==.
replace cmt_actornumber=4 if actor4!=. & actor5==.
replace cmt_actornumber=5 if actor5!=. & actor6==.
replace cmt_actornumber=6 if actor6!=.

heckoprobit effect4_ i.cmt_sequenc_ag binding3 ratio_cinc icowsal chal_polity2 tgt_polity2 settnump claim_duration i.issue c.cmt_actornumber##c.cmt_actornumber, select(cm_select = ratio_cinc icowsal chal_polity2 tgt_polity2 claim_duration i.issue c.cm_selectyears##c.cm_selectyears##c.cm_selectyears) cluster(claim)
heckoprobit effect4_ i.cmt_sequenc_ag binding3 ratio_cinc icowsal chal_polity2 tgt_polity2 settnump claim_duration i.issue io, select(cm_select = ratio_cinc icowsal chal_polity2 tgt_polity2 claim_duration i.issue c.cm_selectyears##c.cm_selectyears##c.cm_selectyears) cluster(claim)

* Table A9: Additional Controls – Dispute History
set sortseed 123
xtset  claimdy settnump

tab effect4_, gen(effectdummy)
btscs  effectdummy1 year claimdy, g(effectyears1)
btscs  effectdummy2 year claimdy, g(effectyears2)
btscs  effectdummy3 year claimdy, g(effectyears3)
btscs  effectdummy4 year claimdy, g(effectyears4)
btscs  effectdummy5 year claimdy, g(effectyears5)

heckoprobit effect4_ i.cmt_sequenc_ag binding3 ratio_cinc icowsal chal_polity2 tgt_polity2 settnump claim_duration i.issue recmidwt, select(cm_select = ratio_cinc icowsal chal_polity2 tgt_polity2 claim_duration i.issue recmidwt c.cm_selectyears##c.cm_selectyears##c.cm_selectyears) cluster(claim)
heckoprobit effect4_ i.cmt_sequenc_ag binding3 ratio_cinc icowsal chal_polity2 tgt_polity2 settnump claim_duration i.issue c.effectyears2##c.effectyears2##c.effectyears2 c.effectyears3##c.effectyears3##c.effectyears3 c.effectyears4##c.effectyears4##c.effectyears4 c.effectyears5##c.effectyears5##c.effectyears5, select(cm_select = ratio_cinc icowsal chal_polity2 tgt_polity2 claim_duration i.issue c.cm_selectyears##c.cm_selectyears##c.cm_selectyears) cluster(claim)


**************************************************************************************************************
* Note: This code uses set sortseed in a number of instances. This is done because following commands resort *
* the data using variables which do not exist for all observations or exhibit identical values for some of   *
* them. Ordinarily, this means that such "ties" are broken in a random manner, resulting in differences how  *
* the data would be ordered between sessions. For the selection models, this would then result in small      *
* differences in the estimated log likelihood and hence coeffcient and standard errors. However these random *
* differences do not not affect any substantive results. Using set sortseed ensures that the precise results *
* as reported in the paper and online materials can be replicated.                                           *
**************************************************************************************************************


